package biz.inspeed.test.reference;

import java.lang.ref.SoftReference;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;

public class MainReference {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		CatR cat = new CatR();
		SoftReference<CatR> sr = new SoftReference<CatR>(cat);
		System.out.println(ToStringBuilder.reflectionToString(cat));
		System.out.println(ToStringBuilder.reflectionToString(sr.get()));
		System.out.println(StringUtils.repeat("--", 50));
		cat = null;
		System.gc();
		System.out.println(ToStringBuilder.reflectionToString(cat));
		System.out.println(ToStringBuilder.reflectionToString(sr.get()));
		
	}

}

class CatR {
	private String name = "Tom";
	private String server = "JBoss";
	private String language = "Java";
	
	private String occupation = "Programmer";

	public String getName() {
		return name;
	}

	public String getServer() {
		return server;
	}

	public String getLanguage() {
		return language;
	}

	public String getOccupation() {
		return occupation;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setServer(String server) {
		this.server = server;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public void setOccupation(String occupation) {
		this.occupation = occupation;
	}
	
	
	
}
